Repository navigation
test(plugin-security): give each subject state its own it in the delegated-answer posture pin - #31707
Merged
Merged
Conversation
…gated-answer posture pin The "states get, at every door, the answer the id naming no user gets" test booted one rig per state inside a single it(), so all four states shared vitest's default 5 s budget, which a loaded CI shard used up. Each posture now asks the reference state once in a beforeAll and compares every other state to it in an it.each, so each state gets its own budget and its own failure line. No assertion is weakened. Claude-Session: https://claude.ai/code/session_01ADHkmSaqpcZzCHVZRYpzpW Co-authored-by: Claude <noreply@anthropic.com>
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
Contributor
Author
|
domain:server#1 · os-steve · session_01ADHkmPF1skfu2kx89BEXZi 席位核对 · round 1 · head
|
…-h1rua8 # Conflicts: # packages/plugins/plugin-security/src/delegated-admin-own-name-set.posture.test.ts
Contributor
Author
|
domain:server#1 · os-steve · session_01ADHkmPF1skfu2kx89BEXZi 席位 ACCEPT · 冲突轮 · head
|
This was referenced Nov 8, 2026
This was referenced Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Fixes #31663
The card's preferred fix: the one
itthat looped every subject state through every door is split into oneitper state, the same way in all three postures. Claim 6727396721 (domain:server#1, card-thread session_01ADHkmSaqpcZzCHVZRYpzpW).Clause-②: no — measured: test-only diff; no source file, request shape or answer changes, so nothing accepted on base is refused on head and nothing refused is accepted.
Metadata-protocol: none
skip-changeset: the diff is one test file undersrc/that the package does not ship (plugin-security'sfiles[]publishesdist,README.md,CHANGELOG.md; the builtdist/holds zero hits for this test's title text, against a positive control,DelegationScopeViolationError, in 2 built files), so nothing any released package publishes changes.维护者速读
packages/plugins/plugin-security/src/delegated-admin-own-name-set.posture.test.ts第 878 行起的新 describe。pnpm --filter @objectstack/plugin-security exec vitest run src/delegated-admin-own-name-set.posture.test.ts—— 预期 202 passed(main 上 193)。What changes
packages/plugins/plugin-security/src/delegated-admin-own-name-set.posture.test.ts— in the describe "a delegated answer about a user the caller cannot read does not depend on that user's existence or memberships", theit"the 4 states get, at every door, the answer the id naming no user gets" becomes adescribeof that same title, per posture:beforeAllasks every door once for the reference state,an id naming no user(one rig).it"an id naming no user: the write gate's scope violation, and each explain door's refusal …" holds the reference answer's assertions, unchanged:403 DELEGATION_SCOPE_VIOLATIONat the four write shapes,403 PERMISSION_DENIEDat both explain doors, and the twodetailspins.it.eachover the other three states: each boots its own rig and assertstoEqual(reference). That is the cross-state equality, kept as its own assertion per state, with the state as the failure label.beforeAlljoins the vitest import.testTimeout, no per-test timeout, no skip, no assertion removed or loosened. The forced test edit is this restructuring itself; no other test moved.Tests
Test count of the file: 106 → 115 on the first head (+3 per posture = 4 states − 1). After merging
origin/main(b126c1306, which brought #31634's two describes into this file): 193 on main → 202 on head8c1ef9f0, the same +9. The wholeplugin-securitysuite on8c1ef9f0: 1280 files, 6079 tests: 6034 passed, 45 skipped, 0 failed.Slowest case, 20 consecutive runs of the file each side (
vitest run --maxWorkers=3 --sequence.concurrent=false; 3 is CI'sVITEST_MAX_WORKERSon the 4-core runner, read fromscripts/vitest-worker-cap.mjs), underos-verify-lock, on a 4-core shared container:5d1382a5: the oneit(p50 / p99 / max)c2516ef6: slowest stateit(p50 / p99 / max)On the merged head
8c1ef9f0, 20/20 more runs green, 202/202 each; the slowest split state's p99 is 252 / 268 / 254 ms (group / isolated / single), and the slowest test in the file is the untouchedground truthitat 685 ms.Slowest case on
c2516ef6: 298 ms, posturegroup, state "a user whose business unit is outside the scope". The referenceititself takes 2–4 ms (the boot is in thebeforeAll). In the full-suite run under the package's own load, the slowest split case was 242 ms. 20/20 runs green on base and 20/20 on head.Reading: on this box the old
itused about a fifth of its 5 s budget; CI's timeout came from shard load (Test Core 8/8 runs several packages at once), which this box does not reproduce. After the split eachitcarries one rig, about a quarter of the old work, against the same 5 s budget.Acceptance notes
ground truth: the delegate reads the subject exactly in the states where it is a user the delegate may readitin the same describe also loops (five rigs, read door only): p99 705–782 ms on base, 737–760 ms on head over the same 20 runs. It is lighter than the split loop was (one read per state, not six doors) and outside this card's Fix; noted, not changed.Verification
Merge of
origin/main(8c1ef9f0).mainmoved 19 commits; #31634 (18cdcb20) edited this file. The only conflict was the vitest import line (both sides addedbeforeAll); it resolves to main's line,describe, it, expect, afterEach, beforeAll, afterAll, vi. #31634's tests are kept byte-for-byte:git diff origin/mainon the file is exactly this PR's split (+28 / -15). Its describes do not carry the card's shape (their per-state refusals already share onebeforeAllrig per state), so nothing of theirs was split. On8c1ef9f0: 20 × the file under the lock, VERDICT command-exit 0; whole suite as above;typecheckVERDICT command-exit 0; eslint exit 0;dispatch-gates --commandsthe same 53, all exit 0,--ran53 derived, 53 run, 0 NOT-MEASURED, 0 UNRUN. CI on8c1ef9f0: every check suite completed with no failure.Round 1, all on head
c2516ef6, after its last commit:Commands and verdicts
pnpm exec turbo run build --concurrency=2 --filter='@objectstack/plugin-security^...'then--filter='./packages/**'underos-verify-lock: VERDICT command-exit 0 both.vitest run --maxWorkers=3 --sequence.concurrent=false src/delegated-admin-own-name-set.posture.test.tson base and on head, one lock hold each: VERDICT command-exit 0, every run exit 0.vitest run --maxWorkers=3(wholeplugin-security) under the lock: VERDICT command-exit 0, 5933 passed / 45 skipped / 0 failed.pnpm --filter @objectstack/plugin-security typecheckunder the lock: VERDICT command-exit 0 (check:test-typecheck: OK, 0 errors).eslint --no-inline-config packages/plugins/plugin-security: exit 0.node scripts/pm/dispatch-gates.mjs --commands: 53 commands, all run, all exit 0. Three first answered exit 3 (prerequisite not met) and were re-run green after their prerequisite:check-plugin-teardown-shape --self-test(after fetching its pinned fixture commit),check:dual-build-cjs-loadsandcheck:i18n(after the full package build).--ranreconciliation: 53 derived, 53 run, 0 NOT-MEASURED, 0 UNRUN.Generated by Claude Code